@echo off
echo 正在启动Zipkin服务器...

REM 检查是否安装了Docker
docker -v > nul 2>&1
if %errorlevel% equ 0 (
    echo 使用Docker启动Zipkin...
    docker rm -f zipkin > nul 2>&1
    docker run -d -p 9411:9411 --name zipkin openzipkin/zipkin
) else (
    echo 未检测到Docker，尝试使用Java启动Zipkin...
    
    REM 检查是否已下载Zipkin JAR文件
    if not exist zipkin.jar (
        echo 正在下载Zipkin...
        powershell -Command "Invoke-WebRequest -Uri 'https://repo1.maven.org/maven2/io/zipkin/java/zipkin-server/2.12.9/zipkin-server-2.12.9-exec.jar' -OutFile 'zipkin.jar'"
    )
    
    echo 启动Zipkin服务器...
    start java -jar zipkin.jar
)

echo Zipkin服务器启动成功，访问地址: http://localhost:9411
echo. 